<extend name="Base/base" />
<block name="body">
<div class="with-padding bg-primary" style="text-align:center; font-size:20px; padding:10px 20px;">代理中心</div>
<div class="container" style="margin-top:20px;">
  <blockquote>注册代理</blockquote>
  <form class="form-horizontal" method="post">
    <input type="hidden" name="pid" value="{$pid}"/>
    <div class="form-group">
      <div class="col-xs-12">
        <input type="text" class="form-control input-lg" id="username" name="username" placeholder="姓名">
      </div>
    </div>
    <div class="form-group">
      <div class="col-xs-12">
        <input type="text" class="form-control input-lg" id="mobile" name="mobile" placeholder="电话">
      </div>
    </div>
    <div class="form-group">
      <div class="col-xs-12">
        <input type="text" class="form-control input-lg" id="email" name="email" placeholder="邮箱">
      </div>
    </div>
    <div class="form-group">
      <div class="col-xs-12">
        <input type="text" class="form-control input-lg" id="qq" name="qq" placeholder="QQ">
      </div>
    </div>
    <div class="form-group">
      <div class="col-xs-12">
        <input class="form-control input-lg" id="wx" name="wx" type="text" placeholder="微信">
      </div>
    </div>
    <div class="form-group">
      <div class="col-xs-12">
        <input class="form-control input-lg" id="password" name="password" type="text" placeholder="密码">
      </div>
    </div>
    <div class="form-group">
      <div class="col-xs-12">
        <input class="form-control input-lg" id="repassword" name="repassword" type="PASSWORD" placeholder="重复免密">
      </div>
    </div>
    <div class="form-group">
      <div class="col-xs-8">
        <input type="text" class="form-control input-lg" id="code" name="code" placeholder="输入短信验证码">
      </div>
      <div class="col-xs-4">
        <a href="javascript:;" onclick="send_vcode();" id="vcode_btn" class="btn btn-block btn-primary btn-lg">获取验证码</a>
      </div>
    </div>
    <div class="form-group">
      <div class="col-xs-12">
        <button type="submit" class="btn btn-block btn-primary btn-lg">登陆</button>
      </div>
    </div>
  </form>
</div>
</block>
<block name="js">
<script>
var countdown=60; 
function send_vcode(){
  var obj = $("#vcode_btn");
  var mobile = $('#mobile').val();
  if ( ! obj.attr('disabled')) {
    $.ajax({
      url: '/public/send_vcode',
      type: 'POST',
      dataType: 'json',
      data: {'mobile': mobile, 'type':1},
      success:function(res) {
        if (res.status != 1) {
          alert(res.message);
        }
      }
    });
  }
  settime(obj);
}

function settime(obj) { //发送验证码倒计时
  if (countdown == 0) { 
    obj.attr('disabled',false); 
    obj.html("获取验证码");
    countdown = 60; 
    return;
  } else { 
    obj.attr('disabled',true);
    obj.html("重新发送(" + countdown + ")");
    countdown--; 
  } 
  setTimeout(function() { 
    settime(obj) }
    ,1000) 
}
</script>
</block>
